package iohomework;

import java.io.*;

public class SecCopyDemo02 {
    public static void main(String[] args) throws IOException {

        File file = new File("cxk.jpg");
        FileInputStream fis = new FileInputStream(file);
        FileOutputStream fos = new FileOutputStream("cxk_cp.jpg");
        long start = System.currentTimeMillis();
        byte[] data = new byte[(int) file.length()];
        int len;
        while ((len = fis.read(data)) != -1) {
            fos.write(data, 0, len);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制成功,耗时" +(end-start)+"ms");
        fis.close();
        fos.close();
    }
}
